﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;

namespace WIAssistant
{
    public delegate void WorkItemColumnTypeVisibleChanged(int fieldID, Visibility visibility);

    public class WorkItemColumnType: INotifyPropertyChanged
    {
        public string Title { get; set; }
        public int Id { get; set; }
        
        public event WorkItemColumnTypeVisibleChanged OnVisibleChanged;

        public bool IsVisible
        {
            get { return _isVisible; }
            set 
            {
                _isVisible = value; 
                OnPropertyChanged("IsVisible");
                if (OnVisibleChanged != null)
                    OnVisibleChanged(Id, _isVisible ? Visibility.Visible : Visibility.Collapsed);
            }
        }
        private bool _isVisible = true;

        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public override string ToString()
        {
            return Title;
        }

    }
}
